<?php

require_once 'app/conf/database.php';

class Conection {

	private static $openMysql = 0;
	
    /*
    Colocando o constructor como private impede que a classe seja instanciada.
    */
    private function __construct() {
    		echo "";
    }

    /**
     * Sigleton mysql
     *
     * @return object_mysql
     */
    public static function open() {

        if ( self::$openMysql == 0 ){
 
        	self::$openMysql = mysql_connect( DB_HOST, DB_USER, DB_PASS);
        	mysql_select_db( DB_BASE, self::$openMysql );
        	mysql_set_charset('utf8');
			
    	}
    	
    	return self::$openMysql;

    }
    
}

?>
